#include <Arduino.h>
#include "cmsis_os.h"

#define TASK1_STK_SIZE 512
void task1(void* pdata);
osThreadDef(task1, osPriorityNormal, 1, TASK1_STK_SIZE);

void task1(void* pdata) {
  int count = 1;
  while (1) {
    printf("\r\nHello world!\r\n###This is task1 ,count is %d \r\n", count++);
    digitalToggle(LED_BUILTIN);
    osDelay(80);
  }
}

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  SerialUSB.begin();
  
  osKernelInitialize();                   // TOS Tiny kernel initialize
  osThreadCreate(osThread(task1), NULL);  // Create task1

  osKernelStart();  // Start TOS Tiny
}

void loop() {}